package com.iflytek.elpmobile.utils.network;

import java.io.File;
import java.io.IOException;
import java.util.Map;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;

import android.content.ContentValues;

import com.simple.elpmobile.utils.network.model.NetworkStatusListener;
import com.simple.elpmobile.utils.network.model.TaskHandle;

public class HTTPUtils {
	public static final String HTTP_HEAD_PHOTO = "photo";
	public static final String HTTP_HEAD_SPEEX = "speex";
	
	public static void initHandler() {
		HttpGetTask task = new HttpGetTask("http://www.iflytek.com", null);
		task.init();
	}
 
	/**
	 * 下载文件
	 * 
	 * @param url
	 *            文件URL
	 * @param path
	 *            文件路径
	 * @return 任务句柄
	 */
	public static TaskHandle download(String url, String path,
			NetworkStatusListener listener) {
		DownloadTask task = new DownloadTask(url, path, listener);
		task.start();

		return task;
	}

	public static TaskHandle httpGet(String url, NetworkStatusListener listener) {
		HttpGetTask task = new HttpGetTask(url, listener);
		task.start();

		return task;
	}
}
